<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
 <style>
   div{
     width: 300px;
     height: 400px;
     margin: 40px auto;
     position: relative;
   }
   img{
     width: 300px;
     height: 300px;
   }
   input{
    width: 80px;
    display: block;
    position: absolute;
    left: 50%;
    transform: translateX(-50%) translateY(50%);
   }
   .rotate{
     animation: rotate 5s linear infinite;
   }
   @keyframes rotate{
     from{
       transform: rotateZ(0deg);
     }
     to{
       transform: rotateZ(360deg);
     }
   }
   .pause{
     animation-play-state:paused;
   }
 </style>
</head>
<body>
  <div>
    <img src="lianpu.png" alt="">
    <audio src="lan_zhi_ling_yin.mp3"></audio>
    <input type="button" value="播放">
  </div>
  <script>
    var input = document.querySelector('input');
    var img = document.querySelector('img');
    var audio = document.querySelector('audio');
    input.onclick = function(){
      var flag = audio.paused;
      if(flag == true){
        audio.play();
        this.value = '暂停';
        // img.classList.remove('pause');
        // img.classList.add('rotate');
        img.className = '';
        img.className = 'rotate';
      }else{
        audio.pause();
        this.value = '播放';
        img.className = 'pause rotate';
        // img.classList.add('pause');
      }
    }
  </script>
</body>
</html>
<!-- <!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
 <style>
   *{
     margin: 0;
     padding: 0;
   }
   img{
     display: block;
     width: 300px;
     margin: 50px auto;
   }
   input{
     display: block;
     margin: 0 auto;
     width: 80px;
   }
   .rotate{
     animation:rotate 5s linear infinite;
   }
   @keyframes rotate{
     from{
      transform: rotateZ(0deg);
     }
     to{
      transform: rotateZ(360deg);
     }
   }
   .pause{
     animation-play-state: paused;
   }
 </style>
</head>
<body>
  <img src="lianpu.png" alt="">
  <audio src="lan_zhi_ling_yin.mp3"></audio>
  <input type="button" value="播放">
  <script>
    var img = document.querySelector('img');
    var audio = document.querySelector('audio');
    var input = document.querySelector('input');
    input.onclick = function(){
      var flag = audio.paused;
      
      if(flag == true){
        audio.play();
        input.value = '暂停';
        img.classList.remove('pause')
        img.classList.add('rotate');
      }else{
        audio.pause();
        input.value = '播放';
        img.classList.add('pause');
      }
    }
  </script>
</body>
</html> -->
<!-- <!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    *{
      margin: 0;
      padding: 0;
    }
    div{
      width: 300px;
      margin: 50px auto;
    }
    img{
      width: 100%;
    }
    input{
     display: block;
     width: 80px;
     margin: 20px auto;
    }
    .rotate{
      animation: rotate 5s linear infinite;
    }
    @keyframes rotate{
      from{
        transform: rotateY(0deg);
      }
      to{
        transform: rotateZ(360deg);
      }
    }
    .pause{
      animation-play-state: paused
    }
  </style>
</head>
<body>
  <div>
    <img src="lianpu.png" alt="">
    <audio src="lan_zhi_ling_yin.mp3"></audio>
    <input type="button" value="播放">
  </div>
  <script>
    var input = document.querySelector('input');
    var audio = document.querySelector('audio');
    var img = document.querySelector('img');
    input.onclick = function(){
      var flag = audio.paused;
      if(flag == true){
        audio.play();
        input.value = '暂停';
        img.className = 'rotate';
      }else{
        audio.pause();
        input.value = '播放';
        img.className = 'pause rotate'
      }
    }
  </script>
</body>
</html> -->